package com.py.credit.dao;

import com.py.credit.common.Page;
import com.py.credit.entity.LhjcBatchLog;
import com.py.credit.entity.LhjcBatchStat;
import com.py.credit.entity.LhjcCube;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 采集批次日志dao
 *
 * @author likai
 */
public interface LhjcBatchLogDao {

    List<LhjcBatchLog> getListForPage(@Param(value = "startTime") String startTime,
                                      @Param(value = "endTime") String endTime,
                                      @Param(value = "batchId") String batchId,
                                      @Param(value = "realName") String realName,
                                      @Param(value = "target") String target,
                                      @Param(value = "result") String result,
                                      @Param(value = "page") Page page);

    /**
     * 添加批次日志
     *
     * @param batchId   批次号
     * @param target    目标表
     * @param type      采集类型
     * @param orgBm     所属编码
     * @param result    采集结果
     * @param managerId 创建者ID
     * @param status    批次采集状态
     */
    void insert(@Param(value = "batchId") String batchId,
                @Param(value = "target") int target,
                @Param(value = "type") String type,
                @Param(value = "dataSourceId") int dataSourceId,
                @Param(value = "orgBm") String orgBm,
                @Param(value = "result") String result,
                @Param(value = "managerId") long managerId,
                @Param(value = "status") String status,
                @Param(value = "realName") String realName);

    /**
     * @param batchId
     * @param result
     * @param tcount
     * @param scount
     * @param fcount
     * @param rcount
     * @param status
     */
    void update(@Param(value = "batchId") String batchId,
                @Param(value = "result") String result,
                @Param(value = "tcount") int tcount,
                @Param(value = "scount") int scount,
                @Param(value = "fcount") int fcount,
                @Param(value = "rcount") int rcount,
                @Param(value = "status") String status);

    /**
     * @param batchId
     * @param status
     */
    void updateStatus(@Param(value = "batchId") String batchId,
                      @Param(value = "status") String status);

    /**
     * 根据batchId获取采集批次详情
     *
     * @param batchId
     * @return
     */
    LhjcBatchLog select(@Param(value = "batchId") String batchId);

    /**
     * 获取每日数据报表
     *
     * @param orgBm
     * @return
     */
    List<LhjcBatchStat> getDayData(@Param(value = "orgBm") String orgBm,
                                   @Param(value = "tableId") int tableId);

    /**
     * 删除批次日志
     *
     * @param batchId
     */
    void delete(@Param(value = "batchId") String batchId);

    void updateStatusAndDate(@Param(value = "batchId") String batchId,
                             @Param(value = "updateStatus") String updateStatus);

    LhjcCube queryCubeById(@Param(value = "cubId") int cubId);
}
